<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>大眼窝拣货单_____{:toDate(time())}______拣货人：</title>
<load href='__PUBLIC__/bootstrap/css/bootstrap.min.css' />
<load href='__PUBLIC__/Css/style.css' />
<style type="text/css">
	.order_info{height:352px;margin-left: 1px;}
	.order_info .row {min-height: 19px;line-height: 19px;}
	.table-bordered table-striped {
		border: 1px dashed black;
	}
	.table th, .table td {
		border-top: 1px dashed black;
	}
</style>
<?php 
	function merge_order_detail(&$order_detail,$sale_detail){
        foreach ($sale_detail as $key => $value) {
            __merge_order_detail($order_detail,$sale_detail,$value,$key);
        }
        return $order_detail;
    }

    function __merge_order_detail(&$order_detail,$sale_detail,$value,$key){
       
            if($key == 0)
                $order_detail[0] = $value;
            else{
                if( !empty($value['out_number'])  
                	&& $value['out_number'] == $sale_detail[$key-1]['out_number']
                   && $value['options'] == $sale_detail[$key-1]['options'] ){
                    if(is_array($order_detail[$key-1])){
                       $order_detail[$key-1]['number'] += $value['number'];
                        $order_detail[$key-1]['total'] += $value['total']; 
                    }else{
                        __merge_order_detail($order_detail,$sale_detail,$value,$key-1);
                    }
                    
                }else
                   $order_detail[$key] = $value;
            }
        return $order_detail;
    }
 ?>
</head>
<body>
<div id="main" class="main" >
		<div class="order_info" >
			<div class="row">
				<div class="span9">
					<table class="table table-condensed table-bordered table-striped">
					<tr> <td colspan=3 class="alert">大眼窝拣货单<a href="__URL__/export_picklist/oid/{$_REQUEST.oid}" class="btn btn-primary offset3"> <i class="icon-download-alt  icon-white"></i>导出CSV</a>
						<button onClick="window.print()" class="offset1 btn btn-primary"><i class="icon-print  icon-white"></i>打印</button></td>
					 </tr>
	                <tr>
	                    <td>序</td><td>商品名称</td>
	                    <!--<th width="80">规格</th><th>编号</th><th>商品名称</th> <th>仓位</th> -->
	                    <td class="span1">数量</td>
	                </tr>
	                <volist name="orders" id="sa">
	                	<?php $is_virtual = getModelName($sa['product_id'],'Product','is_virtual'); ?>
	                	<eq name="is_virtual " value="0"><!--非虚拟物品，则打印配货单-->
	                    <tr>
	                        <td>{$i}</td>
	                        <td class="span8"> <notempty name="sa.product_id">{$sa.product_id|getModelName='Product'}<else/>{$sa.sale_title} {$sa.options}</notempty>
	                        	&nbsp;&nbsp;({$sa.sale_no}  )
	                        </td>
	                       
	                        <td>{$sa.number}</td>
	                    </tr>
	                    </eq>
	                </volist>
	            </table>
				</div>
			</div>
		</div>
	

</div>
</body>
</html>
